package com.example.blog_system_ssm.component;

import org.springframework.util.StringUtils;

public class StringTools {

    // todo:将文章正文截取成文章摘要
    public static String subLength(String val,int maxLength){
        if(!StringUtils.hasLength(val) || maxLength <= 0) return val;
        if(val.length() <= maxLength) return val;
        return val.substring(0,maxLength);
    }
}
